package Problem;

//
// Created by ✎﹏ℳ๓独赏☆独醉 on 2024/1/14.
// 
public class 赋值字符串 {
    public static void main(String[] args) {
//        String str01 = "abcde";
//        StringBuilder strb02 = new StringBuilder(str01);
//        for (int i = 0; i < str01.length(); i++) {
//            strb02.setCharAt(i,str01.charAt(i));
//        }
//        String str02 = strb02.toString();
//        System.out.println(str01);
//        System.out.println(str01.hashCode());
//        System.out.println(str02);
//        System.out.println(str02.hashCode());
//        String str03 = "";
//        System.out.println(str03.hashCode());
//        str03 = str01;
//        System.out.println(str03.hashCode());

        String str01 = "abcde";
        char[] str01arr = str01.toCharArray();
        char[] str02arr = new char[str01arr.length];
        for (int i = 0; i < str01arr.length; i++) {
            str02arr[i] = str01arr[i];
        }
        String str02 = new String(str02arr);
        System.out.println(str01.hashCode());
        System.out.println(str02.hashCode());
        System.out.println(str02);
        System.out.println(str02.hashCode());
    }
}
